/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tophey.client;

import com.nazca.ui.NInternalDiag;
import com.nazca.ui.UIUtilities;
import com.nazca.ui.model.SimpleObjectListModel;
import com.nazca.ui.pagination.PaginationListener;
import com.nazca.ui.pagination.TablePageSession;
import com.nazca.ui.util.CardLayoutWrapper;
import com.tophey.client.lis.*;
import com.tophey.client.model.SSITableModel;
import com.tophey.common.PageResult;
import com.tophey.common.ServerInfoDetail;
import com.tophey.model.Category;
import com.tophey.model.ServerInfo;
import com.tophey.model.ServerSysInfo;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.apache.commons.beanutils.BeanUtils;

/**
 *
 * @author xiang.fu
 */
public class MainPanel extends javax.swing.JPanel {

    private SimpleObjectListModel<Category> cateListModel = new SimpleObjectListModel<Category>();
    private SSITableModel ssiTableModel = new SSITableModel();
    private CardLayoutWrapper cardLeft = null;
    private CardLayoutWrapper cardRight = null;
    private QueryCategoryAgent queryCateAgent = null;
    private String curQueryServerSid = "";
    private QueryServerAgent queryServerAgent = null;
    private Category curCategory = null;
//    private ServerInfoDetail curServer = null;
    private List<ServerInfoDetail> curSelectedServers = new ArrayList<ServerInfoDetail>();
    private UpdateServerAgent updateServerAgent = null;
    private AddServerAgent addServerAgent = null;
    private DeleteServerAgent deleteServerAgent = null;
    private BatchUpdateServerAgent batchUpdateAgent = null;

    /**
     * Creates new form NewJPanel
     */
    public MainPanel() {
        initComponents();
        initModel();
        initUI();
        initLis();
        initALL();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        updateP = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        nameTxf4u = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        urlTxf4u = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        lineTxf4u = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        serverNumTxf4u = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        confirmUpdateBtn = new javax.swing.JButton();
        cancelUpdateBtn = new javax.swing.JButton();
        updateMsgLb = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        descTxp4u = new javax.swing.JTextPane();
        jLabel6 = new javax.swing.JLabel();
        score4u = new javax.swing.JTextField();
        addP = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        nameTxf4a = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        urlTxf4a = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        lineTxf4a = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        serverNumTxf4a = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        confirmAddBtn = new javax.swing.JButton();
        cancelAddBtn = new javax.swing.JButton();
        addMsgLb = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        descTxp4a = new javax.swing.JTextPane();
        jLabel12 = new javax.swing.JLabel();
        score4a = new javax.swing.JTextField();
        deleteP = new javax.swing.JPanel();
        deletePrompt = new javax.swing.JLabel();
        cancelDeleteBtn = new javax.swing.JButton();
        confirmDeleteBtn = new javax.swing.JButton();
        deleteMsgLb = new javax.swing.JLabel();
        batchUpdateP = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        serverNum4BatchUpdate = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        lineTxf4BatchUpdate = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        scoreTxf4BatchUpdate = new javax.swing.JTextField();
        serverNumNoModiCb = new javax.swing.JCheckBox();
        lineCbNoModiCb = new javax.swing.JCheckBox();
        scoreCbNoModiScore = new javax.swing.JCheckBox();
        cancelBatchUpdateBtn = new javax.swing.JButton();
        confirmBatchUpdateBtn = new javax.swing.JButton();
        batchUpdateMsgLb = new javax.swing.JLabel();
        jSplitPane1 = new javax.swing.JSplitPane();
        jPanel2 = new javax.swing.JPanel();
        jToolBar2 = new javax.swing.JToolBar();
        jButton4 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        waitingPanel1 = new com.nazca.ui.WaitingPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        failureInfoPanel1 = new com.nazca.ui.FailureInfoPanel();
        jPanel1 = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        jButton5 = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        paginationPanel1 = new com.nazca.ui.pagination.PaginationPanel();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        failureInfoPanel2 = new com.nazca.ui.FailureInfoPanel();
        waitingPanel2 = new com.nazca.ui.WaitingPanel();

        jLabel1.setText("名称：");

        jLabel2.setText("url：");

        jLabel3.setText("线路：");

        jLabel4.setText("服务器数：");

        jLabel5.setText("描述：");

        confirmUpdateBtn.setText("修改");
        confirmUpdateBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                confirmUpdateBtnActionPerformed(evt);
            }
        });

        cancelUpdateBtn.setText("取消");
        cancelUpdateBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelUpdateBtnActionPerformed(evt);
            }
        });

        updateMsgLb.setText("jLabel6");

        jScrollPane3.setViewportView(descTxp4u);

        jLabel6.setText("分数：");

        javax.swing.GroupLayout updatePLayout = new javax.swing.GroupLayout(updateP);
        updateP.setLayout(updatePLayout);
        updatePLayout.setHorizontalGroup(
            updatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(updatePLayout.createSequentialGroup()
                .addGroup(updatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(updatePLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addGroup(updatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(updatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(nameTxf4u)
                            .addComponent(urlTxf4u)
                            .addComponent(lineTxf4u)
                            .addComponent(serverNumTxf4u)
                            .addComponent(jScrollPane3)
                            .addComponent(score4u)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, updatePLayout.createSequentialGroup()
                        .addContainerGap(372, Short.MAX_VALUE)
                        .addComponent(updateMsgLb)
                        .addGap(18, 18, 18)
                        .addComponent(confirmUpdateBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(cancelUpdateBtn)))
                .addContainerGap())
        );
        updatePLayout.setVerticalGroup(
            updatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(updatePLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(updatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(nameTxf4u, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(updatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(urlTxf4u, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(updatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(lineTxf4u, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(updatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(serverNumTxf4u, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(updatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(score4u, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(updatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(updatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(confirmUpdateBtn)
                    .addComponent(cancelUpdateBtn)
                    .addComponent(updateMsgLb))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel7.setText("名称：");

        jLabel8.setText("url：");

        jLabel9.setText("线路：");

        jLabel10.setText("服务器数：");

        jLabel11.setText("描述：");

        confirmAddBtn.setText("增加");
        confirmAddBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                confirmAddBtnActionPerformed(evt);
            }
        });

        cancelAddBtn.setText("取消");
        cancelAddBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelAddBtnActionPerformed(evt);
            }
        });

        addMsgLb.setText("jLabel6");

        jScrollPane4.setViewportView(descTxp4a);

        jLabel12.setText("分数：");

        javax.swing.GroupLayout addPLayout = new javax.swing.GroupLayout(addP);
        addP.setLayout(addPLayout);
        addPLayout.setHorizontalGroup(
            addPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addPLayout.createSequentialGroup()
                .addGroup(addPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addPLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addGroup(addPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(addPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(nameTxf4a)
                            .addComponent(urlTxf4a)
                            .addComponent(lineTxf4a)
                            .addComponent(serverNumTxf4a)
                            .addComponent(jScrollPane4)
                            .addComponent(score4a)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addPLayout.createSequentialGroup()
                        .addContainerGap(372, Short.MAX_VALUE)
                        .addComponent(addMsgLb)
                        .addGap(18, 18, 18)
                        .addComponent(confirmAddBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(cancelAddBtn)))
                .addContainerGap())
        );
        addPLayout.setVerticalGroup(
            addPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addPLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(addPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(nameTxf4a, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(addPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(urlTxf4a, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(addPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(lineTxf4a, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(addPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(serverNumTxf4a, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(addPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(score4a, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(addPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel11)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(addPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(confirmAddBtn)
                    .addComponent(cancelAddBtn)
                    .addComponent(addMsgLb))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        deletePrompt.setText("确定删除选中的x个Server Info？");

        cancelDeleteBtn.setText("取消");
        cancelDeleteBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelDeleteBtnActionPerformed(evt);
            }
        });

        confirmDeleteBtn.setText("删除");
        confirmDeleteBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                confirmDeleteBtnActionPerformed(evt);
            }
        });

        deleteMsgLb.setText("jLabel14");

        javax.swing.GroupLayout deletePLayout = new javax.swing.GroupLayout(deleteP);
        deleteP.setLayout(deletePLayout);
        deletePLayout.setHorizontalGroup(
            deletePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(deletePLayout.createSequentialGroup()
                .addGroup(deletePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(deletePLayout.createSequentialGroup()
                        .addContainerGap(134, Short.MAX_VALUE)
                        .addComponent(deleteMsgLb)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(confirmDeleteBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cancelDeleteBtn))
                    .addGroup(deletePLayout.createSequentialGroup()
                        .addGap(40, 40, 40)
                        .addComponent(deletePrompt)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        deletePLayout.setVerticalGroup(
            deletePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(deletePLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(deletePrompt)
                .addGap(18, 18, 18)
                .addGroup(deletePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cancelDeleteBtn)
                    .addComponent(confirmDeleteBtn)
                    .addComponent(deleteMsgLb))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel13.setText("服务器数量：");

        jLabel14.setText("线路：");

        jLabel15.setText("分数：");

        serverNumNoModiCb.setText("不修改");

        lineCbNoModiCb.setText("不修改");

        scoreCbNoModiScore.setText("不修改");

        cancelBatchUpdateBtn.setText("取消");
        cancelBatchUpdateBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelBatchUpdateBtnActionPerformed(evt);
            }
        });

        confirmBatchUpdateBtn.setText("确定");
        confirmBatchUpdateBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                confirmBatchUpdateBtnActionPerformed(evt);
            }
        });

        batchUpdateMsgLb.setText("jLabel16");

        javax.swing.GroupLayout batchUpdatePLayout = new javax.swing.GroupLayout(batchUpdateP);
        batchUpdateP.setLayout(batchUpdatePLayout);
        batchUpdatePLayout.setHorizontalGroup(
            batchUpdatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(batchUpdatePLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(batchUpdatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(batchUpdatePLayout.createSequentialGroup()
                        .addComponent(batchUpdateMsgLb)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(confirmBatchUpdateBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cancelBatchUpdateBtn))
                    .addGroup(batchUpdatePLayout.createSequentialGroup()
                        .addGroup(batchUpdatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel15)
                            .addComponent(jLabel14)
                            .addComponent(jLabel13))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(batchUpdatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(serverNum4BatchUpdate)
                            .addComponent(lineTxf4BatchUpdate)
                            .addComponent(scoreTxf4BatchUpdate, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(batchUpdatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(serverNumNoModiCb)
                            .addComponent(lineCbNoModiCb)
                            .addComponent(scoreCbNoModiScore))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        batchUpdatePLayout.setVerticalGroup(
            batchUpdatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(batchUpdatePLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(batchUpdatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(serverNum4BatchUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(serverNumNoModiCb))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(batchUpdatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(lineTxf4BatchUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lineCbNoModiCb))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(batchUpdatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(scoreTxf4BatchUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(scoreCbNoModiScore))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(batchUpdatePLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cancelBatchUpdateBtn)
                    .addComponent(confirmBatchUpdateBtn)
                    .addComponent(batchUpdateMsgLb))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        setLayout(new java.awt.BorderLayout());

        jSplitPane1.setDividerLocation(300);

        jPanel2.setLayout(new java.awt.BorderLayout());

        jToolBar2.setRollover(true);

        jButton4.setText("jButton4");
        jButton4.setFocusable(false);
        jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar2.add(jButton4);

        jPanel2.add(jToolBar2, java.awt.BorderLayout.PAGE_START);

        jPanel3.setLayout(new java.awt.CardLayout());
        jPanel3.add(waitingPanel1, "WAIT");

        jList1.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jList1.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                jList1ValueChanged(evt);
            }
        });
        jScrollPane1.setViewportView(jList1);

        jPanel3.add(jScrollPane1, "CONTENT");
        jPanel3.add(failureInfoPanel1, "FAIL");

        jPanel2.add(jPanel3, java.awt.BorderLayout.CENTER);

        jSplitPane1.setLeftComponent(jPanel2);

        jPanel1.setLayout(new java.awt.BorderLayout());

        jToolBar1.setFloatable(false);
        jToolBar1.setRollover(true);

        jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/tophey/client/res/refresh.png"))); // NOI18N
        jButton5.setText("刷新");
        jButton5.setFocusable(false);
        jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton5);

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/tophey/client/res/add.png"))); // NOI18N
        jButton1.setText("增加");
        jButton1.setFocusable(false);
        jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton1);

        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/tophey/client/res/update.png"))); // NOI18N
        jButton2.setText("修改");
        jButton2.setFocusable(false);
        jButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton2);

        jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/tophey/client/res/batch_update.png"))); // NOI18N
        jButton6.setText("批量修改");
        jButton6.setFocusable(false);
        jButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton6);

        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/tophey/client/res/delete.png"))); // NOI18N
        jButton3.setText("删除");
        jButton3.setFocusable(false);
        jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton3);

        jPanel1.add(jToolBar1, java.awt.BorderLayout.NORTH);
        jPanel1.add(paginationPanel1, java.awt.BorderLayout.SOUTH);

        jPanel4.setLayout(new java.awt.CardLayout());

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane2.setViewportView(jTable1);

        jPanel4.add(jScrollPane2, "CONTENT");
        jPanel4.add(failureInfoPanel2, "FAIL");
        jPanel4.add(waitingPanel2, "WAIT");

        jPanel1.add(jPanel4, java.awt.BorderLayout.CENTER);

        jSplitPane1.setRightComponent(jPanel1);

        add(jSplitPane1, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

    private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList1ValueChanged
        // TODO add your handling code here:
    }//GEN-LAST:event_jList1ValueChanged

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        if (curSelectedServers.isEmpty()) {
            UIUtilities.errorDlg(this, "错误", "亲，请选择一个server");
            return;
        }
        ServerInfoDetail curServer = curSelectedServers.get(0);
        updateMsgLb.setText("");
        nameTxf4u.setText(curServer.getServerInfo().getName());
        urlTxf4u.setText(curServer.getServerInfo().getUrl());
        lineTxf4u.setText(curServer.getServerInfo().getLine());

        ServerSysInfo ssi = curServer.getServerSysInfo();
        serverNumTxf4u.setText(ssi == null ? "" : String.valueOf(ssi.getServerNum()));
        score4u.setText(ssi == null ? "" : String.valueOf(ssi.getScore()));
        descTxp4u.setText(curServer.getServerInfo().getDescription());

        
        NInternalDiag nd = new NInternalDiag("修改", updateP);
        nd.showInternalDiag(this);

    }//GEN-LAST:event_jButton2ActionPerformed

    private void cancelUpdateBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelUpdateBtnActionPerformed
        NInternalDiag nd = NInternalDiag.findNInternalDiag(updateP);
        if (nd != null) {
            nd.hideDiag();
        }
    }//GEN-LAST:event_cancelUpdateBtnActionPerformed

    private void confirmUpdateBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_confirmUpdateBtnActionPerformed
        try {
            ServerInfoDetail curServer = curSelectedServers.get(0);
            ServerSysInfo ssi = (ServerSysInfo) BeanUtils.cloneBean(curServer.getServerSysInfo());
            ServerInfo si = (ServerInfo) BeanUtils.cloneBean(curServer.getServerInfo());
            si.setName(nameTxf4u.getText().trim());
            si.setUrl(urlTxf4u.getText().trim());
            si.setLine(lineTxf4u.getText().trim());
            si.setDescription(descTxp4u.getText().trim());
            try {
                ssi.setServerNum(Integer.valueOf(serverNumTxf4u.getText().trim()));
                ssi.setScore(Double.valueOf(score4u.getText().trim()));
            } catch (Exception ex) {
                ex.printStackTrace();
                updateMsgLb.setText("格式错啦");
                return;
            }
            ServerInfoDetail sid = new ServerInfoDetail(si, ssi);
            updateServerAgent.startUpdate(sid);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_confirmUpdateBtnActionPerformed

    private void confirmAddBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_confirmAddBtnActionPerformed

        ServerSysInfo ssi = new ServerSysInfo();
        ServerInfo si = new ServerInfo();
        si.setCategoryId(curCategory.getId());
        ssi.setCategoryId(curCategory.getId());

        si.setName(nameTxf4a.getText().trim());
        ssi.setName(nameTxf4a.getText().trim());
        si.setUrl(urlTxf4a.getText().trim());
        si.setLine(lineTxf4a.getText().trim());
        si.setDescription(descTxp4a.getText().trim());
        try {
            ssi.setServerNum(Integer.valueOf(serverNumTxf4a.getText().trim()));
            ssi.setScore(Double.valueOf(score4a.getText().trim()));
        } catch (Exception ex) {
            ex.printStackTrace();
            addMsgLb.setText("格式错啦");
            return;
        }
        ServerInfoDetail sid = new ServerInfoDetail(si, ssi);
        addServerAgent.startAdd(sid);

    }//GEN-LAST:event_confirmAddBtnActionPerformed

    private void cancelAddBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelAddBtnActionPerformed
        NInternalDiag nd = NInternalDiag.findNInternalDiag(addP);
        if (nd != null) {

            nd.hideDiag();
        }
    }//GEN-LAST:event_cancelAddBtnActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        if (curCategory == null) {
            UIUtilities.errorDlg(this, "错误", "亲，请选择一个分类");
            return;
        }
        addMsgLb.setText("");
        nameTxf4a.setText("");
        urlTxf4a.setText("");
        lineTxf4a.setText("");


        serverNumTxf4a.setText("");
        score4a.setText("");
        descTxp4a.setText("");


        
        NInternalDiag nd = new NInternalDiag("增加", addP);
        nd.showInternalDiag(this);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        if (curSelectedServers.isEmpty()) {
            UIUtilities.errorDlg(this, "提示", "至少选择一个server");
            return;
        }
        deleteMsgLb.setVisible(false);

        deletePrompt.setText("确定要删除选中的" + curSelectedServers.size() + "个Server Info么？");
        
        NInternalDiag nd = new NInternalDiag("删除", deleteP);
        nd.showInternalDiag(this);



    }//GEN-LAST:event_jButton3ActionPerformed

    private void cancelDeleteBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelDeleteBtnActionPerformed
        NInternalDiag nd = NInternalDiag.findNInternalDiag(deleteP);
        if (nd != null) {
            nd.hideDiag();
        }
    }//GEN-LAST:event_cancelDeleteBtnActionPerformed

    private void confirmDeleteBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_confirmDeleteBtnActionPerformed
        deleteServerAgent.startDelete(curSelectedServers);
    }//GEN-LAST:event_confirmDeleteBtnActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        TablePageSession ps = paginationPanel1.getPageSession();
        if (curCategory != null) {
            curQueryServerSid = UUID.randomUUID().toString();
            queryServerAgent.startQuery(curQueryServerSid, String.valueOf(curCategory.getId()), (ps.getCurPageNum() - 1) * ps.getPageSize(), ps.getPageSize());
        }
    }//GEN-LAST:event_jButton5ActionPerformed

    private void cancelBatchUpdateBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelBatchUpdateBtnActionPerformed
        NInternalDiag nd = NInternalDiag.findNInternalDiag(batchUpdateP);
        if (nd != null) {
            nd.hideDiag();
        }
    }//GEN-LAST:event_cancelBatchUpdateBtnActionPerformed

    private void confirmBatchUpdateBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_confirmBatchUpdateBtnActionPerformed
        List<ServerInfoDetail> sids = new ArrayList<ServerInfoDetail>();
        try {
            for (ServerInfoDetail sid : curSelectedServers) {

                ServerSysInfo ssi = (ServerSysInfo) BeanUtils.cloneBean(sid.getServerSysInfo());
                ServerInfo si = (ServerInfo) BeanUtils.cloneBean(sid.getServerInfo());
                if (!lineCbNoModiCb.isSelected()) {

                    si.setLine(lineTxf4BatchUpdate.getText().trim());
                }
                if (!serverNumNoModiCb.isSelected()) {
                    try {
                        ssi.setServerNum(Integer.valueOf(serverNum4BatchUpdate.getText().trim()));
                    } catch (Exception ex) {
                        batchUpdateMsgLb.setText("服务器数格式错误");
                        batchUpdateMsgLb.setVisible(true);
                        return;
                    }
                }

                if (!scoreCbNoModiScore.isSelected()) {
                    try {
                        ssi.setScore(Integer.valueOf(scoreTxf4BatchUpdate.getText().trim()));
                    } catch (Exception ex) {
                        batchUpdateMsgLb.setText("分数格式错误");
                        batchUpdateMsgLb.setVisible(true);
                        return;
                    }
                }
                ServerInfoDetail sidNew = new ServerInfoDetail(si, ssi);
                sids.add(sidNew);
            }
            batchUpdateAgent.startUpdate(sids);

        } catch (Exception ex) {
            ex.printStackTrace();
        }

    }//GEN-LAST:event_confirmBatchUpdateBtnActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        NInternalDiag nd = new NInternalDiag("批量修改", batchUpdateP);
        batchUpdateMsgLb.setVisible(false);
        lineCbNoModiCb.setSelected(false);
        serverNumNoModiCb.setSelected(false);
        scoreCbNoModiScore.setSelected(false);
        lineTxf4BatchUpdate.setText("");
        lineTxf4BatchUpdate.setEnabled(true);
        scoreTxf4BatchUpdate.setText("");
        scoreTxf4BatchUpdate.setEnabled(true);
        serverNum4BatchUpdate.setText("");
        serverNum4BatchUpdate.setEnabled(true);
        this.getRootPane().setDefaultButton(cancelBatchUpdateBtn);
        nd.showInternalDiag(this);

    }//GEN-LAST:event_jButton6ActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel addMsgLb;
    private javax.swing.JPanel addP;
    private javax.swing.JLabel batchUpdateMsgLb;
    private javax.swing.JPanel batchUpdateP;
    private javax.swing.JButton cancelAddBtn;
    private javax.swing.JButton cancelBatchUpdateBtn;
    private javax.swing.JButton cancelDeleteBtn;
    private javax.swing.JButton cancelUpdateBtn;
    private javax.swing.JButton confirmAddBtn;
    private javax.swing.JButton confirmBatchUpdateBtn;
    private javax.swing.JButton confirmDeleteBtn;
    private javax.swing.JButton confirmUpdateBtn;
    private javax.swing.JLabel deleteMsgLb;
    private javax.swing.JPanel deleteP;
    private javax.swing.JLabel deletePrompt;
    private javax.swing.JTextPane descTxp4a;
    private javax.swing.JTextPane descTxp4u;
    private com.nazca.ui.FailureInfoPanel failureInfoPanel1;
    private com.nazca.ui.FailureInfoPanel failureInfoPanel2;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JList jList1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JToolBar jToolBar2;
    private javax.swing.JCheckBox lineCbNoModiCb;
    private javax.swing.JTextField lineTxf4BatchUpdate;
    private javax.swing.JTextField lineTxf4a;
    private javax.swing.JTextField lineTxf4u;
    private javax.swing.JTextField nameTxf4a;
    private javax.swing.JTextField nameTxf4u;
    private com.nazca.ui.pagination.PaginationPanel paginationPanel1;
    private javax.swing.JTextField score4a;
    private javax.swing.JTextField score4u;
    private javax.swing.JCheckBox scoreCbNoModiScore;
    private javax.swing.JTextField scoreTxf4BatchUpdate;
    private javax.swing.JTextField serverNum4BatchUpdate;
    private javax.swing.JCheckBox serverNumNoModiCb;
    private javax.swing.JTextField serverNumTxf4a;
    private javax.swing.JTextField serverNumTxf4u;
    private javax.swing.JLabel updateMsgLb;
    private javax.swing.JPanel updateP;
    private javax.swing.JTextField urlTxf4a;
    private javax.swing.JTextField urlTxf4u;
    private com.nazca.ui.WaitingPanel waitingPanel1;
    private com.nazca.ui.WaitingPanel waitingPanel2;
    // End of variables declaration//GEN-END:variables

    private void initModel() {
        jList1.setModel(cateListModel);
        jTable1.setModel(ssiTableModel);
    }

    private void initUI() {
        cardLeft = new CardLayoutWrapper(jPanel3);
        cardRight = new CardLayoutWrapper(jPanel4);
        paginationPanel1.initPage(100, 100);


    }

    private void initLis() {
        queryCateAgent = new QueryCategoryAgent();
        queryCateAgent.addListener(queryCategoryAgentLis);

        queryServerAgent = new QueryServerAgent();
        queryServerAgent.addListener(queryServerAgentLis);


        updateServerAgent = new UpdateServerAgent();
        updateServerAgent.addListener(updateServerAgentlis);

        addServerAgent = new AddServerAgent();
        addServerAgent.addListener(addServerAgentlis);
        deleteServerAgent = new DeleteServerAgent();
        deleteServerAgent.addListener(deleteServerAgentlis);

        batchUpdateAgent = new BatchUpdateServerAgent();
        batchUpdateAgent.addListener(batchUpdateServerAgentlis);

        paginationPanel1.addPaginationListener(new PaginationListener() {

            @Override
            public void onPageChanged(TablePageSession page) {
                TablePageSession ps = paginationPanel1.getPageSession();
                if (curCategory != null) {
                    curQueryServerSid = UUID.randomUUID().toString();
                    queryServerAgent.startQuery(curQueryServerSid, String.valueOf(curCategory.getId()), (ps.getCurPageNum() - 1) * ps.getPageSize(), ps.getPageSize());
                }
            }
        });


        jList1.addListSelectionListener(new ListSelectionListener() {

            @Override
            public void valueChanged(ListSelectionEvent e) {
//                if(!e.getValueIsAdjusting()){
                curCategory = (Category) jList1.getSelectedValue();
//                    curCategory = cateListModel.getSelectedItem();
                TablePageSession ps = paginationPanel1.getPageSession();
                if (curCategory != null) {
                    curQueryServerSid = UUID.randomUUID().toString();
                    queryServerAgent.startQuery(curQueryServerSid, String.valueOf(curCategory.getId()), (ps.getCurPageNum() - 1) * ps.getPageSize(), ps.getPageSize());
                }
//                }
            }
        });



        jTable1.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

            @Override
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    curSelectedServers.clear();
                    int[] idis = jTable1.getSelectedRows();
                    for (int idx : idis) {
                        if (idx >= 0) {
                            idx = jTable1.convertRowIndexToModel(idx);
                            curSelectedServers.add(ssiTableModel.getServerInfoDetail(idx));
                        }
//                    int idx = jTable1.getSelectedRow();
//                    if (idx >= 0) {
//                        idx = jTable1.convertRowIndexToModel(idx);
//                        curServer = ssiTableModel.getServerInfoDetail(idx);
//                    } else {
//                        curServer = null;
//                    }
                    }
                }
            }
        });


        jTable1.addMouseListener(
                new MouseAdapter() {

                    @Override
                    public void mouseClicked(MouseEvent e) {
                        if (UIUtilities.isLeftDoubleClick(e)) {
                            jButton2ActionPerformed(null);
                        }
                    }
                });


        scoreCbNoModiScore.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                if (scoreCbNoModiScore.isSelected()) {
                    scoreTxf4BatchUpdate.setEnabled(false);
                } else {
                    scoreTxf4BatchUpdate.setEnabled(true);
                }
            }
        });


        lineCbNoModiCb.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                if (lineCbNoModiCb.isSelected()) {
                    lineTxf4BatchUpdate.setEnabled(false);
                } else {
                    lineTxf4BatchUpdate.setEnabled(true);
                }
            }
        });

        serverNumNoModiCb.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                if (serverNumNoModiCb.isSelected()) {
                    serverNum4BatchUpdate.setEnabled(false);
                } else {
                    serverNum4BatchUpdate.setEnabled(true);
                }
            }
        });

    }
    private QueryCategoryAgentListener queryCategoryAgentLis = new QueryCategoryAgentListener() {

        @Override
        public void onStart() {
            cardLeft.show("WAIT");

        }

        @Override
        public void onSuccess(List<Category> allCate) {
            cardLeft.show("CONTENT");
            cateListModel.setObjectList(allCate);
        }

        @Override
        public void onFailed(int errCode, String errMsg) {
            cardLeft.show("FAIL");
            failureInfoPanel1.setFailedInfo(errMsg);
        }
    };
    private AddServerAgentListener addServerAgentlis = new AddServerAgentListener() {

        @Override
        public void onStart() {
            confirmAddBtn.setEnabled(false);
            cancelAddBtn.setEnabled(false);
            addMsgLb.setText("正在更新...");
        }

        @Override
        public void onSuccess(final ServerInfoDetail allCate) {
            addMsgLb.setText("增加成功");
//            TablePageSession ps = paginationPanel1.getPageSession();
//            if (curCategory != null) {
//                queryServerAgent.startQuery(String.valueOf(curCategory.getId()), (ps.getCurPageNum() - 1) * ps.getPageSize(), ps.getPageSize());
//            }

            ssiTableModel.add(0, allCate);

            new Thread() {

                @Override
                public void run() {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(MainPanel.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    SwingUtilities.invokeLater(new Runnable() {

                        public void run() {
                            confirmAddBtn.setEnabled(true);
                            cancelAddBtn.setEnabled(true);
                            cancelAddBtnActionPerformed(null);
                        }
                    });
                }
            }.start();
        }

        @Override
        public void onFailed(int errCode, String errMsg) {
            addMsgLb.setText("增加失败");
            confirmAddBtn.setEnabled(true);
            cancelAddBtn.setEnabled(true);
        }
    };
    private DeleteServerAgentListener deleteServerAgentlis = new DeleteServerAgentListener() {

        @Override
        public void onStart() {
            confirmDeleteBtn.setEnabled(false);
            cancelDeleteBtn.setEnabled(false);
            deleteMsgLb.setText("正在删除...");
        }

        @Override
        public void onSuccess() {
            deleteMsgLb.setText("删除成功");
            ssiTableModel.removeList(curSelectedServers);

            new Thread() {

                @Override
                public void run() {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(MainPanel.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    SwingUtilities.invokeLater(new Runnable() {

                        public void run() {
                            confirmDeleteBtn.setEnabled(true);
                            cancelDeleteBtn.setEnabled(true);
                            cancelDeleteBtnActionPerformed(null);
                        }
                    });
                }
            }.start();
        }

        @Override
        public void onFailed(int errCode, String errMsg) {
            deleteMsgLb.setText("删除失败");
            confirmDeleteBtn.setEnabled(true);
            cancelDeleteBtn.setEnabled(true);
        }
    };
    private UpdateServerAgentListener updateServerAgentlis = new UpdateServerAgentListener() {

        @Override
        public void onStart() {
            confirmUpdateBtn.setEnabled(false);
            cancelUpdateBtn.setEnabled(false);
            updateMsgLb.setText("正在更新...");
        }

        @Override
        public void onSuccess(final ServerInfoDetail allCate) {
            updateMsgLb.setText("更新成功");
//            TablePageSession ps = paginationPanel1.getPageSession();
//            if (curCategory != null) {
//                queryServerAgent.startQuery(String.valueOf(curCategory.getId()), (ps.getCurPageNum() - 1) * ps.getPageSize(), ps.getPageSize());
//            }

            ssiTableModel.update(allCate);
//            curServer = allCate;
            int idx = jTable1.getSelectedRow();
            jTable1.getSelectionModel().setSelectionInterval(idx, idx);

            new Thread() {

                @Override
                public void run() {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(MainPanel.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    SwingUtilities.invokeLater(new Runnable() {

                        public void run() {
                            confirmUpdateBtn.setEnabled(true);
                            cancelUpdateBtn.setEnabled(true);
                            cancelUpdateBtnActionPerformed(null);
                        }
                    });
                }
            }.start();
        }

        @Override
        public void onFailed(int errCode, String errMsg) {
            updateMsgLb.setText("更新失败");
            confirmUpdateBtn.setEnabled(true);
            cancelUpdateBtn.setEnabled(true);
        }
    };
    private BatchUpdateServerAgentListener batchUpdateServerAgentlis = new BatchUpdateServerAgentListener() {

        @Override
        public void onStart() {
            confirmBatchUpdateBtn.setEnabled(false);
            cancelBatchUpdateBtn.setEnabled(false);
            batchUpdateMsgLb.setText("正在更新...");
        }

        @Override
        public void onSuccess(final List<ServerInfoDetail> allCate) {
            batchUpdateMsgLb.setText("更新成功");
//            TablePageSession ps = paginationPanel1.getPageSession();
//            if (curCategory != null) {
//                queryServerAgent.startQuery(String.valueOf(curCategory.getId()), (ps.getCurPageNum() - 1) * ps.getPageSize(), ps.getPageSize());
//            }

            for (ServerInfoDetail sid : allCate) {

                ssiTableModel.update(sid);
            }


//            curServer = allCate;
            int idx = jTable1.getSelectedRow();
            jTable1.getSelectionModel().setSelectionInterval(idx, idx);

            new Thread() {

                @Override
                public void run() {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(MainPanel.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    SwingUtilities.invokeLater(new Runnable() {

                        public void run() {
                            confirmBatchUpdateBtn.setEnabled(true);
                            cancelBatchUpdateBtn.setEnabled(true);
                            cancelBatchUpdateBtnActionPerformed(null);
                        }
                    });
                }
            }.start();
        }

        @Override
        public void onFailed(int errCode, String errMsg) {
            updateMsgLb.setText("更新失败");
            confirmUpdateBtn.setEnabled(true);
            cancelUpdateBtn.setEnabled(true);
        }
    };
    private QueryServerAgentListener queryServerAgentLis = new QueryServerAgentListener() {

        @Override
        public void onStart(String sid) {
            if (!curQueryServerSid.equals(sid)) {
                return;
            }
            cardRight.show("WAIT");
        }

        @Override
        public void onSuccess(String sid, PageResult<ServerInfoDetail> allCate) {
            if (!curQueryServerSid.equals(sid)) {
                return;
            }
            cardRight.show("CONTENT");
            ssiTableModel.setList(allCate.getPageList());
            paginationPanel1.initPageButKeepSession(allCate.getTotalCount(), allCate.getPageSize());
        }

        @Override
        public void onFailed(String sid, int errCode, String errMsg) {
            if (!curQueryServerSid.equals(sid)) {
                return;
            }
            cardLeft.show("FAIL");
            failureInfoPanel1.setFailedInfo(errMsg);
        }
    };

    private void initALL() {
        queryCateAgent.startQuery();
    }
}
